<template>
  <div class="tenance">
    <headnav></headnav>
    <div class="tenancemain">
      <div class="surface"> 
        <el-select v-model="surface" clearable filterable placeholder="请选择">
            <el-option
                v-for="item in options"
                :key="item.value"
                :label="item.label"
                :value="item.value">
            </el-option>
        </el-select>
        <el-button type="primary">查询</el-button>
          </div>
            <el-table
            :data="tableData"
            style="width: 100%">
            <el-table-column
              prop="name"
              label="表名"
              width="230">
              <template  slot-scope="scope">
                   <a @click="watchSurface(scope.row.name)" class="surfaceA" href="javascript:;">{{scope.row.name}}</a>
              </template>
            </el-table-column>
            <el-table-column
              prop="fileSrc"
              label="文件地址">
            </el-table-column>
            <el-table-column
              prop="fileSize"
              label="文件大小"
              width="180">
              
            </el-table-column>
            <el-table-column
              prop="fileNum"
              label="文件个数"
              width="180">
            </el-table-column>
            <el-table-column
              
              label="操作"
              width="180">
              <template  slot-scope="scope">
                  <el-button @click="cleaned(scope.row)" type="text" size="small">清空</el-button>
                  <el-button @click="backups(scope.row)" type="text" size="small">备份</el-button>
              </template>
            </el-table-column>
          </el-table>
        <el-pagination class="page"
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :current-page="currentPage"
        :page-sizes="[100, 200, 300, 400]"
        :page-size="100"
        layout="total, sizes, prev, pager, next, jumper"
        :total="400">
        </el-pagination>
    <el-dialog :title="diaTitle" :visible.sync="isTable">
        <el-table :data="tableList2" >
      <template v-for="(col,index) in cols">
        <el-table-column  :prop="col.prop" :label="col.label" :key="index" >
        </el-table-column>
      </template>
      
        </el-table>
        <el-pagination
        class="page"
          background
          layout="prev, pager, next"
          :total="1000">
        </el-pagination>
    </el-dialog>
    <el-dialog title="备份" :visible.sync="formDia">
        <el-form :model="form">
            <el-form-item label="备份地址" :label-width="formLabelWidth">
            <el-input v-model="form.name" auto-complete="off"></el-input>
            </el-form-item>
        </el-form>
        <div slot="footer" class="dialog-footer">
            <el-button @click="dialogFormVisible = false">取 消</el-button>
            <el-button type="primary" @click="dialogFormVisible = false">确 定</el-button>
        </div>
    </el-dialog>
    </div>
     
  </div>
</template>

<script>
import headnav from '@/components/HeadNav'
export default {
  name: 'tenance',
  components:{
    headnav
  },
   data () {
    return {
        
        surface:'',
        currentPage:1,
        isTable:false,
        formDia:false,
        diaTitle:"",
        options: [{
          value: '选项1',
          label: '黄金糕'
        }, {
          value: '选项2',
          label: '双皮奶'
        }, {
          value: '选项3',
          label: '蚵仔煎'
        }, {
          value: '选项4',
          label: '龙须面'
        }, {
          value: '选项5',
          label: '北京烤鸭'
        }],
       tableData: [{
            isSxtract: 0,
            name: '表A',
            state: '--'
          }, {
            isSxtract: 1,
            name: '表B',
            state: '--'
          }, {
            isSxtract: 0,
            name: '表C',
            state: '--'
          }, {
            isSxtract: 1,
            name: '表D',
            state: '--'
          }],
        cols:[
        {
          label:"编号",
          prop:"node",
          type:"normal",

        },
        {
          label:"名称",
          prop:"name",
          type:"normal",
          
        },
        {
          label:"类型",
          prop:"type",
          type:"normal",
          
        },
        {
          label:"坐标",
          prop:"coorid",
          type:"normal",
          
        }
      ],
       tableList2:[
        {
          node:"55",
          name:"99",
          type:"qq",
          coorid:"rr"
        },
        {
          node:"66",
          name:"uu",
          type:"ub",
          coorid:"rr"
        }
      ],
      form: {
          name: '',
        },
        formLabelWidth: '120px'
    }
  },
  
  methods:{
     handleSizeChange(val) {
        console.log(`每页 ${val} 条`);
      },
      handleCurrentChange(val) {
        console.log(`当前页: ${val}`);
      },
      watchSurface(val){
          console.log(val);
          this.isTable=true;
          this.diaTitle=val;
      },
    backups(data){
        this.formDia=true;
        console.log(data);
    },
    cleaned(data){
         this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          this.$message({
            type: 'success',
            message: '删除成功!'
          });
        }).catch(() => {
          this.$message({
            type: 'info',
            message: '已取消删除'
          });          
        });
        console.log(data);
    }
  }
}
</script>

<style scoped>
.tenancemain{
    padding: 8px;
}
.page{
    text-align: center
}
a{
    text-decoration: none;
}
</style>